Add Author Name And Date Under Post Title In WordPress

How To Add Author Name And Date Under Post Title In WordPress?

Are you developing a WordPress theme? Are you trying to configure the single post appearance? Do you want to add author name and date under post title in WordPress?

In this post, I am going to walk you through the process which can help you to understand the concept of WordPress functions to display date under post title and the author.

You just have to embed the WordPress functions in the HTML and PHP coding. There is only one line of the code which would do the work for you.

Let Me Show You How Can You Add Author Name And Date Under Post Title In WordPress?

First of all, it would be great if you know the WordPress theme file structure. Let me tell you that the output of the single posts is handled by the single.php file present in your theme.

If you are using any theme and you want to add only the date or only author then it can be done. But it is recommended to show the published date and the author.

Let me provide you the proper code.

<?php the_time(‘F jS, Y’); ?> | by <?php the_author(); ?> | <?php edit_post_link(); ?>

This code will display date, the author name under the blog post title. And when you login to your WordPress admin panel then you would see an edit link using which you can edit any blog post.

You can modify this code using a little bit of HTML. It would be great if you modify it by adding into a paragraph tag so that you can design it later.

And a few words which would show that the post is published on the date by the author.

<p>Published on <?php the_time(‘F jS, Y’); ?> | by <?php the_author(); ?> | <?php edit_post_link(); ?></p>

It’s your choice whether you choose to display “published or posted”.

If you want to display the author name before the date then just rearrange the codes.

If you want to add author name and date under post title in WordPress theme you have to edit your current theme from the editor or using the cPanel. Just find the single.php file and add this code under the title of the blog post.

You can use this code wherever you want to display the author name and the date.

Isn’t That So Easy To Add Author Name And Date Under Post Title In WordPress?

Most of the web developers face such kind of problem. And if you are trying to develop your first WordPress theme then you would be happy to know that the code shown above would help you to show the post meta data.

You all know that every web developer provides a different code. But the WordPress functions remain the same. You can alter the appearance using CSS.

If you still face any problem, feel free to ask.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.


Get Free Updates Into Your Inbox

Learn Everything Just Like I Did

SUBSCRIBE



28 comments

  1. Hi Ravi,

    Wow – you clearly have a solid understanding of the coding behind WordPress. Thank you for sharing these coding solutions with the rest of us who really would have no idea how to customize WordPress and make it our own.

    1. Hey Neena,

      WordPress provides us freedom to alter the design and the structure of the website. You can add anything you want. Using the above-mentioned code, the developers would be able to show the meta data of the post under the title of the post.

      Thanks for taking the time.

      Have an awesome day.

      ~Ravi

  2. Hello Ravi, Yeppers just as Neena has stated about you sure know about coding my friend! I for one would be lost without plug-ins hehe

    Great Share

    Thanks

    Chery :))

    1. Hey Chery,

      WordPress has many plugins to help you. But I don’t really like to use them. It’s better to do the stuff using the codes because it would help you to reduce the page loading time.

      Thanks for being here.

      Have an awesome day.

      ~Ravi

  3. Hi Ravi

    Interesting to see what goes into coding a WordPress theme.

    It’s not something I ever fancied dong, but it helps to see information like this to appreciate how much work such coders have to do.

    Joy – Blogging After Dark

    1. Hey Joy,

      A WordPress theme consists of many files and different codes. A developer has to try the best and light code so that he/she can develop an amazing theme.

      Adding the post meta data consists just one line with different WordPress functions.

      Thanks for stopping by.

      Enjoy the day.

      ~Ravi

  4. Hi Ravi Chahar,

    Nice tutorial, I was using a plugin for adding dates under posts but seems like you have simplified it never before. Will try this tutorial soon.

    Thanks for sharing.

    1. Hey Osho,

      In every WordPress theme, the date and the author are seen under the post title. You don’t have to use any plugin for that. The coding is required only if you are developing a Theme.

      Thanks for stopping by.

      ~Ravi

  5. Hi Ravi,

    I so wish I had come across something like this when I used my previous theme. For the life of me, I couldn’t get my name under the post as the author and it really bugged me. I looked to see how to remedy this and came up empty handed.

    The theme I use now includes this feature, but I’ll keep this bookmarked and pinned for when I change themes again in the future if it doesn’t happen on its own.

    Thanks so much for putting this together.

    1. Hey Dana,

      If you have a theme without the author name and the date then it means you have chosen the wrong theme. It’s necessary to choose a theme which can show the person behind the content.

      Though if you don’t have any, then you can add using the code. You can edit it just by using the simple words. The WordPress functions would be the same, just the values will vary.

      Thanks for sharing your thoughts.

      Have an amazing day.

      ~Ravi

  6. Hi Ravi, Yes, when I read a blog post, I want to know when it was written and who wrote it. So when I choose a theme, it better allow for including the author’s name and date of the post. Otherwise, that’s a deal breaker.

    Thanks so much for helping theme developers add a must-have feature to their themes.

    1. Hey Carolyn,

      Though most of the theme consist the feature to show the author name and the date but still, if you get the theme without them then you can add it manually.

      Just use the code shown above and you can show your name under the post title or anywhere you want.

      Thanks for stopping by.

      Enjoy the day.

      ~Ravi

  7. Hi Ravi,

    You make coding so easy that a non techie person like me can find it interesting. I thank you so much for teaching in a simple and plain way so that everyone can benefit from this.

    -Donna

    1. Hey Donna,

      I just try to make it as simple as can. It’s because once I was also a non-techie person. I know how it feels when we search for any solution and don’t find any.

      I am happy that I could help you in any way.

      Thanks for the support.

      Hope you are enjoying your week.

      ~Ravi

    1. Hey Erika,

      I am glad that you found it helpful. There are just codes. You have to add one line of the code and your name would be showing under the post title.

      Thanks for all the shares.

      Have a great day.

      ~Ravi

  8. That’s nice, Ravi!

    Thanks for sharing! However, I want to make a float avatar image for author on the left of my blog. Of course, It’ll be look like SearchEngineLance. Anyway, do you have any idea to that?

    Thanks.

    1. Hey Kimsea,

      If you’re good with CSS then anything can be done. Wherever you want to show the image/avatar of the author. You have to use the WordPress function get_avator(); with its values and then use the proper CSS according to the layout of your website.

      It’s all about the designing.

      Thanks for stopping by.

      Have a happy day.

      ~Ravi

  9. Hi Ravi,

    I’m looking for a method to add the author name to the page title that appears under Google Analytics and upon sharing on Facebook. This is useful to readers as my blog has multiple authors, and is SEO friendly.

    Do you have any idea where I can control that?

    Thanks,

    Mariam

    1. Hey Mariam,

      It’s all dependent on what plugin you use for adding sharing buttons. To add an author name under the page title can be handled by the page.php file of the theme.

      Just use the same WordPress code and it will work.

      ~Ravi

  10. Hi Ravi,

    My theme both published date and author name but I want to add author image.

    I have added author image after the blog content but I also want to add it before the content.

    Can you tell me how to do it?

    And one more thing, I am not so much familiar with the coding world.

    1. Hey Komal,

      There are a few plugins which can help you change the gravatar but it’s possible only if your WordPress supports it. To enable the gravatar somewhere else than the default author box, you have to add it through coding. No other option.

      ~Ravi

    1. Hey Beth,

      Every WordPress theme has the different kind code. You should know the basic PHP coding to determine what’s the place to paste this code. This code will show the author name and the date wherever you place it.

      Thanks for stopping by.

      ~Ravi

      1. Got it thank you!!!

        And another question…. Sorry i am a complete amateur and don’t understand PHP much yet, i am just starting to learn….

        If its not too complicated to tell me, can you please let me know how to change the font size/color/class of the time/date/author?

        1. Hey Beth,

          To do so, you have to target the CSS class and add the CSS coding in the theme you’re using. Learn to inspect the elements using your browser and target them.

          Once you find it, go to Appearance>>Customize and you will find a section to add additional CSS.

          ~Ravi

  11. This is such a helpful post, Ravi!

    I’ve been using a theme which doesn’t include an author option for a while now. (Big mistake!) It does however have the date. I just added the author portion of the code above and it worked great…but now I have a small problem. A few of my posts are written by contributing authors who are not registered users on my site.

    Is there a simple way I can change the author’s name for these few posts?

    1. Hey Lori,

      I am glad the code worked for you. Yes, you can change the author name of any post you want. Just search for “change author name” on BloggingLove and you will find a post explaining everything in detail.

      If you still face any problem, just use the contact form to send me an email.

      ~Ravi

Leave a Reply

Your email address will not be published. Required fields are marked *